#include "System.h"
#include "Menu_State.h"
#include "StateMachine.h"
#include <stdio.h>
#include <Windows.h>

System::System()
{
	m_pStateMachine = new StateMachine<System>(System::Instance());
	m_pStateMachine->SetCurrentState(Intro::Instance());
	choose = 0;
}

System* System::Instance()
{
	static System instance;
	return &instance;
}

void System::ChangeState(State<System>* newState)
{
	m_pStateMachine->ChangeState(newState);
}

void System::Update()
{
	m_pStateMachine->Update();
}

void System::DoIntro()
{
	printf("This is Intro run by System\n");
	Sleep(500);
}

void System::DoMainMenu()
{
	int chooseWhat = 0;
	printf("System Game\n1) NewGame\n2)ExitGame\nChoose: ");
	scanf("%d",&choose);
//	choose = chooseWhat;
}

void System::DoNewGame()
{
	printf("New game is created\nCount to zero:");
	for(int i=9;i>=0;i--)
	{
		printf(" %d -",i);
		Sleep(100);
	}
	printf("\nYou won\n");
}

void System::DoExitGame()
{
	printf("Press anykey to exit\n");
	getchar();
	exit(0);
}